#include <iostream>
#include <string>
using namespace std;

bool judgeCircle(string moves) 
{
    if(moves.size() == 0){
        return true;
    }
    int counter[2]={0,0};
    for(int i=0;i!=moves.size();++i){
        if(moves[i] == 'L'){
            ++counter[0];
        }else if(moves[i] == 'R'){
            --counter[0];
        }else if(moves[i] == 'U'){
            ++counter[1];
        }else{
            --counter[1];
        }
    }
    if((counter[0] == 0) && (counter[1] == 0)){
        return true;
    }
    return false;
}

int main(int argc, char const *argv[])
{
    /* code */
    string a="UD";
    cout<<judgeCircle(a)<<endl;
    return 0;
}
